#pragma once
#include "atlwince.h"

class CDraftInfoDlg :
    public CStdDialogResizeImpl<CDraftInfoDlg>
{
public:
    CDraftInfoDlg();

    enum { IDD = IDD_DRAFT_INFO };

    BEGIN_DLGRESIZE_MAP(CDraftInfoDlg)
        DLGRESIZE_CONTROL(IDC_EDT_DRAFT, DLSZ_SIZE_X)
        DLGRESIZE_CONTROL(IDC_STC_STATUS, DLSZ_SIZE_X)
    END_DLGRESIZE_MAP()

    BEGIN_MSG_MAP(CDraftInfoDlg)
        MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
        MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
        MESSAGE_HANDLER(WM_SIZE, OnSize)
        COMMAND_ID_HANDLER(ID_MENU_OK, OnMenuOk)
        COMMAND_ID_HANDLER(ID_MENU_CANCEL, OnMenuCancel)
        COMMAND_ID_HANDLER(ID_MENU_SELECT, OnMenuSelect)
        COMMAND_HANDLER(IDC_EDT_DRAFT, EN_CHANGE, OnEdtDraftChange)
        CHAIN_MSG_MAP(CStdDialogResizeImpl<CDraftInfoDlg>)
    END_MSG_MAP()

    enum Mode
    {
        Mode_NewDraft,
        Mode_SelectDraft
    };

    inline CString GetDraft(void)
    { return m_Draft; }

    inline void SetDraft(CString Draft)
    { m_Draft = Draft; }

    inline void SetMode(Mode m)
    { m_Mode = m; }

private:

    // Handler prototypes (uncomment arguments if needed):
    // LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
    // LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
    // LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/)

    LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled);
    LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled);

    LRESULT OnMenuOk(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
    LRESULT OnMenuCancel(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
    LRESULT OnMenuSelect(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
    LRESULT OnEdtDraftChange(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);

    void UpdateUI(void);

    CEdit m_DraftEdit;
    CStatic m_StatusStc;
    CString m_Draft;
    CString m_StatusFormat;
    Mode m_Mode;
};
